package com.neusoft.yuejian_01.activity;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import com.neusoft.yuejian_01.R;
import com.neusoft.yuejian_01.base.BaseActivity;
import com.neusoft.yuejian_01.javabean.FeedBackBean;
import com.neusoft.yuejian_01.listener.RetrofitListener;
import com.neusoft.yuejian_01.model.FeedBackModel;
/*发表反馈，需要的是用户id和反馈内容*/
public class FeedBackActivity extends BaseActivity implements RetrofitListener {
    private Button feedBackSubmit;
    private  ImageView feedreturn;
    private EditText feedContent;

    protected void initEvents() {
            feedBackSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
                public void onClick(View v) {
                   String FeedContent=feedContent.getText().toString();
                   FeedBackModel feedBackModel=new  FeedBackModel();
                   feedBackModel.feedback(getUser_id(),FeedContent,FeedBackActivity.this);
            }
        });
    }

    @Override
    protected void initData() {
    }
    protected void initView(){
        setContentView(R.layout.activity_feed_back);
        feedreturn=(ImageView) findViewById(R.id.Freturn);
        feedContent=(EditText)findViewById(R.id.feedback);
        feedBackSubmit= (Button) findViewById(R.id.feedSet);
        feedreturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setResult(RESULT_CANCELED);
                finish();
            }
        });
    }
    @Override
    public void onSuccess(Object object, int flag) {
        FeedBackBean addFeedBackBean = (FeedBackBean)object;
        if (addFeedBackBean.getSuccess().equals("0")){
            Toast.makeText(FeedBackActivity.this,"反馈送达失败",Toast.LENGTH_SHORT).show();;
        }else {
            Toast.makeText(FeedBackActivity.this,"反馈已经送达",Toast.LENGTH_SHORT).show();
        }
    }
    @Override
    public void onFail() {

    }
}
